/**
 * 对象相关的方法
 */


/**
 * 对象合并
 *
 * @param target
 * @param source
 * @returns {*}
 */
function deepMerge(target, source) {
    for (const key in source) {
        if (source.hasOwnProperty(key)) {
            if (source[key] instanceof Object) {
                if (!target.hasOwnProperty(key) || !(target[key] instanceof Object)) {
                    target[key] = {};
                }
                deepMerge(target[key], source[key]);
            } else {
                target[key] = source[key];
            }
        }
    }
    return target;
}


module.exports = {
    deepMerge,
}
